﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BigDataFramework.Library.Helpers
{
    public static class DateTimeHelper
    {
        public static long ToUnixTimeStamp(DateTime dt)
        {
            TimeSpan t = (dt - new DateTime(1970, 1, 1));
            long timestamp = (long)t.TotalSeconds;

            return timestamp;
        }
        public static DateTime FromUnixTimeStamp(long unixTime)
        {
            DateTime output = new DateTime(1970, 1, 1);
            output = output.AddSeconds(unixTime);

            return output;
        }
    }
}
